mongodb query to check empty array

87

mongodb query to check empty array -

collection.find({ arrayElementName: { $exists: true, $not: {$size: 0} } })

mongodb empty an array field -

db.collection.update({}, { $set : {'myArray': [] }} , {multi:true} )

Comments

Submit
0 Comments